# coding=utf-8
import allure
from appium.webdriver.common.appiumby import AppiumBy

from app_auto_po.basepage.app import WeWorkApp
from app_auto_po.page.search_member_page import SearchPage
from app_auto_po.utils.log_util import logger


class EditPersonInfoPage(WeWorkApp):

    # 删除成员
    __DEL_BTN = '删除成员',"up"
    # 确认删除
    __CONFIEM_DEL_BTN = AppiumBy.XPATH,'//*[@text="删除"]'

    # 删除成员
    @allure.step("滑动到底部，找到删除按钮，最后点击")
    def delete_member(self):
        # 滑动到底部，找到删除按钮，最后点击
        logger.info("点击删除成员")
        ele = self.swipe_find_text(*self.__DEL_BTN)
        ele.click()
        return self


    # 确认删除，返回到搜索页面
    @allure.step("确认删除成员")
    def confirm_delete(self):
        logger.info("确认删除成员")
        self.click(*self.__CONFIEM_DEL_BTN)
        return SearchPage(self.driver)

